// pages/inkEventsDetail/inkEventsDetail.js
import profile from '../../profile.js'

const app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    lang: app.globalData.language,
    index: profile.inkProductDetail,

    indicatorDots: true,
    vertical: false,
    autoplay: true,
    interval: 2000,
    duration: 500,
    indicatorColor: 'rgba(255,255,255,.5)',
    indicatorActiveColor: '#fff',

    //imgheights: [],
    //swiperHeight: '',
  },

  // swiperChangeTap: function (e) {
  //   console.log(e.detail.current);
  //   let height = this.data.imgheights[e.detail.current]
  //   this.setData({
  //     swiperHeight: height
  //   })
  // },

  // swiperLoadTap: function (e) {
  //   let windowWidth = wx.getSystemInfoSync().windowWidth
  //   let imgwidth = e.detail.width, imgheight = e.detail.height, ratio = imgwidth / imgheight;
  //   let viewHeight = windowWidth / ratio;
  //   imgheight = viewHeight;
  //   let imgheights = this.data.imgheights;
  //   imgheights[e.target.id] = imgheight;
  //   this.setData({
  //     imgheights: imgheights,
  //     swiperHeight: imgheights[0]
  //   })
  // },

  // 语言切换事件
  menuTap: function (e) {
    this.setData({
      lang: e.detail.lang
    })
    if (app.globalData.language == 'cn'){
      wx.setNavigationBarTitle({
        title: '艺术课'
      })
    }else{
      wx.setNavigationBarTitle({
        title: 'Art Class'
      })
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.setData({
      lang: app.globalData.language
    })
    if (app.globalData.language == 'cn'){
      wx.setNavigationBarTitle({
        title: '艺术活动'
      })
    }else{
      wx.setNavigationBarTitle({
        title: 'Art Events'
      })
    }
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 3,
        lang: app.globalData.language
      })
    }
  },
})